$(document).ready(function(){
    //---------------------------------动态生成面包屑-------------------------------------------
    $(".bangding1").click(function(){
        //alert($(this).html());
        //首先找自己的
        var myselfhtml = $(this).find(".bangding2").first().html();

        var parenthtml = $(this).parents(".bangding1").find(".bangding2").first().html();
        //清掉原有内容
        $("#breadAppend").empty();

        if (parenthtml == undefined) {
            // console.log(parenthtml);
            var html = '<li>'
            html +=  '<i class="fa fa-home"></i>&nbsp;&nbsp;<a href="/main.html">'+myselfhtml+'</a>&nbsp;&nbsp <i class="fa fa-angle-right"></i>&nbsp;&nbsp;'
            html += '</li>';
            $("#breadAppend").append(html);
        }else{
            // console.log(myselfhtml);
            var html = '<li>'
            html +=  '<i class="fa fa-home"></i>&nbsp;&nbsp;<a href="/main.html">'+parenthtml+'</a>&nbsp;&nbsp <i class="fa fa-angle-right"></i>&nbsp;&nbsp;'
            html += '</li>';
            html += '<li>'
            html +=  '<a href="/main.html">'+myselfhtml+'</a>&nbsp;&nbsp;'
            html += '</li>';
            $("#breadAppend").append(html);
        }
        //阻止事件冒泡
        event.stopPropagation();
    })
//------------------------------------时间控件------------------------------------------
    function showLocale(objD) {
        var str, colorhead, colorfoot;
        var yy = objD.getYear();
        if (yy < 1900) yy = yy + 1900;
        var MM = objD.getMonth() + 1;
        if (MM < 10) MM = '0' + MM;
        var dd = objD.getDate();
        if (dd < 10) dd = '0' + dd;
        var hh = objD.getHours();
        if (hh < 10) hh = '0' + hh;
        var mm = objD.getMinutes();
        if (mm < 10) mm = '0' + mm;
        var ss = objD.getSeconds();
        if (ss < 10) ss = '0' + ss;
        var ww = objD.getDay();
        if (ww == 0) colorhead = "<font color=\"#FF0000\">";
        if (ww > 0 && ww < 6) colorhead = "<font color=\"#373737\">";
        if (ww == 6) colorhead = "<font color=\"#008000\">";
        if (ww == 0) ww = "星期日";
        if (ww == 1) ww = "星期一";
        if (ww == 2) ww = "星期二";
        if (ww == 3) ww = "星期三";
        if (ww == 4) ww = "星期四";
        if (ww == 5) ww = "星期五";
        if (ww == 6) ww = "星期六";
        colorfoot = "</font>"
        str = colorhead + yy + "-" + MM + "-" + dd + " " + hh + ":" + mm + ":" + ss + "  " + ww + colorfoot;
        return (str);
    }
    function tick() {

        var today;
        today = new Date();
        var strdate=showLocale(today);
        document.getElementById("localtime").innerHTML=strdate;
        window.setTimeout("tick()", 1000);
    }
    tick();


});

//删除信息
/*$(function() {
    //要删除的值
   /!* var roomId=null;
    $(".btn-danger").click(function() { //注册删除按钮点击事件
        roomId = $(this).parent().siblings().eq(1).html();
        appendContent(roomId);
        $(".mask").show(); //显示背景色
        showDialog(); //设置提示对话框的Top与Left
        $(".dialog").show(); //显示提示对话框
    })*!/
    /!*!//拼接content的内容
    function appendContent(roomId) {
        $(".content").empty();
        var html = "<img src='/images/room/roomTanC/delete.png' alt=\"\"/>"
        html += "您确定要删除房间号为:"
        html += "<font color='red' style='font-weight: bold'>";
        html += roomId+'号房间';
        html += "</font>的该条记录吗？"
        $(".content").append(html);
    }*!/
    /!*
    *根据当前页面与滚动条位置，设置提示对话框的Top与Left
    *!/
    function showDialog() {
        var objW = $(window); //当前窗口
        var objC = $(".dialog"); //对话框
        var brsW = objW.width();
        var brsH = objW.height();
        var sclL = objW.scrollLeft();
        var sclT = objW.scrollTop();
        var curW = objC.width();
        var curH = objC.height();
        //计算对话框居中时的左边距
        var left = sclL + (brsW - curW) / 2;
        //计算对话框居中时的上边距
        var top = sclT + (brsH - curH) / 2;
        //设置对话框在页面中的位置
        objC.css({ "left": left, "top": top });
    }

    $(window).resize(function() {//页面窗口大小改变事件
        if (!$(".dialog").is(":visible")) {
            return;
        }
        showDialog(); //设置提示对话框的Top与Left
    });

    $(".title img").click(function() { //关闭图片点击事件
        $(".dialog").hide();
        $(".mask").hide();
    })

    $("#Button3").click(function() {//取消按钮点击事件
        $(".dialog").hide();
        $(".mask").hide();
    })

   /!* $("#Button2").click(function() {//确定按钮点击事件
        $(".dialog").hide();
        $(".mask").hide();
        //在这里执行操作
        var dateRoom = ajax_getRoomInfoById(roomId);
        if (dateRoom.status.statusId==1){
            alert("当前房间有人居住");
        } else if (dateRoom.status.statusId==2){
            alert("当前房间已经预定");
        } else{
            ajax_deleteRoom(roomId);

        }
        // alert(dateRoom.status.statusName);//删除某行数据


    })*!/

})*/
/*//这里jquery查询数据
function ajax_getRoomInfoById(roomId){
    var url = "/room/getRoomInfo";
    var params = "roomId="+roomId;

    $.ajax({
        async:false,
        url: url,
        data:params,
        type: "POST",
        dataType: "json",
        success: function(result){
            check_res=result;
        },error:function(){}
    });
    return check_res;
}*/
//在这里执行删除命令
/*function ajax_deleteRoom(roomId) {
    var url = "/room/toDeleteRoomInfo";
    var params = "roomId="+roomId;

    $.ajax({
        async:false,
        url: url,
        data:params,
        type: "POST",
        dataType: "json",
        success: function(result){
            //console.log(result.success);
            if (result.success){
                alert("删除成功！");
                var message = $("#form1").serialize()
                location.href="/room/toRoomSet?pageNum=1&"+message;
            } else {
                alert("删除失败！");
            }
        },error:function(){}
    });*/

/*}*/
